<template >
    <div>
        <div @click="myMethodFun">setup 函数式</div>
      {{ a }}  {{ refb }}
    </div>
</template>
<script lang="ts">
import {onMounted,ref,defineComponent} from 'vue'
interface UserInfo  {
  id: number
  name: string
  age: number
}
export default defineComponent({
    props:{
        name:{
            type:String
        },
        userInfo: {
        type: Object as PropType<UserInfo>, // 泛型类型
        required: true
        }
    },
    
    setup(props,context) {
        console.log('props', props);
        const a=120;
        const refb = ref(220);
        const myMethodFun = ()=>{
            console.log('myMethodFun')
        }
        const {attrs,emit,slots,expose} = context

        expose({
            a,
            myMethodFun
        })

        console.log('slots', slots);
        emit('emitFun')
        // onMounted(()=>{
        //     // emit('emitFun')
        // })
       

        return {
            a,
            refb,
            myMethodFun
        }
    }
})
</script>
<style lang="">
    
</style>